<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Recharge extends Model
{
    protected $table="recharge";
    protected $guarded=[];
    public $timestamps = false;

    //查询充值面额
    public static function store($id){
        return Recharge::find($id);
    }

    //新增充值面额
    public static function addOrUpdate($id,$denomination,$preferential){
        if(!$id){
            return Recharge::insert(['denomination'=>$denomination,'preferential'=>$preferential]);
        }else{
            return Recharge::where(['id'=>$id])->update(['denomination'=>$denomination,'preferential'=>$preferential]);
        }

    }


}
